#pragma once
#include <QObject>
#include <vector>
#include "LBProjectPlanPlug/TaskEditor.h"
//#include "LBKenel/IDocument.h"
#include "ProjectPlan/PPTask.h"
//#include "BaseModel.h"
#include "VCRefCount.h"

namespace LBPROJLOGIC
{
    class CTaskEditor /*: public CProjBaseModel*/
        : public ITaskEditor, public QObject
    {
        //REF_DECLARE_DYNCREATE(CTaskEditor);
		IMPLEMENT_REFCOUNTING(CTaskEditor)

    public:
        CTaskEditor();
        virtual ~CTaskEditor();

    public:
        virtual void ConnectWidget(LBPROJGUI::CGanttChartWidget * pWidget);
		virtual CRefPtr<LBPROJ::IPPContext> GetContext() const override;

    protected:
        void OnAddTask();
        void OnAddSubTask();
        void OnAddMilestone();
        void OnDeleteTask();
        void OnMoveUp();
        void OnMoveDown();
        void OnUpGrade();
        void OnDownGrade();
        void OnEditPreTask();
        void OnShowHideGanttChart();

        void OnUpdateActions();
        void OnTreeViewDoubleClick(const QModelIndex & index);

    private:
        LBPROJGUI::CGanttChartWidget* m_pWidget;

        CRefPtr<LBPROJ::IPPContext> m_pContext;
        std::vector<SEditPreTaskItem> m_vPreTaskList;

        bool m_bShowGanttChart = true;

        QAction* m_addTaskAction;
        QAction* m_addSubTaskAction;
        QAction* m_addMilestoneAction;
        QAction* m_deleteTaskAction;
        QAction* m_moveUpAction;
        QAction* m_moveDownAction;
        QAction* m_upGradeAction;
        QAction* m_downGradeAction;
        QAction* m_editPreTaskAction;
        QAction* m_showHideGanttAction;
    };
}



